
* FIGURE 1 - COMPARE CONSENSUS AND CURRENT INFL WITH AVERAGE EXPECTATIONS OF INFORMED AND UNINFORMED FIRMS

quietly{
use ConsensusAndCurrentInflation, clear  /* Consensus and Eurostat inflation data */

* from Consensus fixed-event expectations (annual infl expected at end of current year, at end of next year) to fixed-horizon (annual inflation expected one year ahead)
* Cfr. Dovern, Fritsche, Slacalek REStat 2012 - from fixed-event to fixed-horizon forecasts 

gen exit1=((12-month+1)*exitm0 + (month-1)*exitm1)/12   
label var exit1 "Consensus forecast over next 12 months (Dovern, Fritsche, Slacalek REStat 2012)"

tsset date
gen picurrent=100*(hit00/l12.hit00 - 1)
label var picurrent "Current realised annual inflation"

gen pifuture=f12.picurrent
label var pifuture "One year ahead realised annual inflation"

save ConsensusExit, replace


* compute average expected infaltion of informed and uninformed firms

use WorkingData, clear
keep dp trimestre it12all treat
collapse (mean) it12all, by(dp trimestre treat)
reshape wide it12all, i(dp trimestre) j(treat)
gen anno=yofd(dofq(dp))
gen date=ym(anno, 3*trimestre)
format date %tm

merge 1:1 date using ConsensusExit
keep if _m==3
drop _m

* ConsensuExit.dta now contains quarterly data data on consensus forecast over the next 12 months, average expected inflation of informed (it12all1) and uninformed (it12all0) firms, current annual inflation (picurrent), inflation realised over next 12 moths (pifuture)

keep dp it12* picurr exit1

line it12all1 it12all0 picurr exit1 dp, lc(black black gray gray) lp( solid longdash shortdash dash_dot) lw(medthick medthick medthick merdthick) graphregion(c(white)) legend(bplace(south) pos(6)) legend(row(2) region(c(none)) order(1 2 3 4) lab(1 "Informed") lab(2 "Not informed") lab(3 "Current infl.") lab(4 "Consensus") ) subti(, bc(white)) xsize(16) ysize(16) tla(2012q4(4)2022q4, angle(90) grid labsi(*0.8)) yla(,angle(0)) xti("")

graph export Fig1.eps, replace

}

* ====================================
* PRINT TO LOG DATA FOR FIG 1
format dp %tq
sort dp
lab var it12all1 "Exp infl - informed"
lab var it12all0 "Exp infl - uninformed"
lab var picurr "Current infl rate "
lab var exit1 "Consensus inflation forecast"
* *********************************
* **** DATA FOR FIG 1 *************
* *********************************
list dp it12all1 it12all0 picurr exit1, linesize(255) header noobs


